<nb-auth-block>
    <h2 class="title">忘记密码</h2>
    <small class="form-text sub-title">输入你的电子邮件地址，我们将发送一个链接重置您的密码</small>
    <form (ngSubmit)="requestPass()" #requestPassForm="ngForm">

        <div *ngIf="showMessages.error && errors && errors.length > 0 && !submitted" class="alert alert-danger" role="alert">
            <div>
                <strong>Oh snap!</strong>
            </div>
            <div *ngFor="let error of errors">{{ error }}</div>
        </div>
        <div *ngIf="showMessages.success && messages && messages.length > 0 && !submitted" class="alert alert-success" role="alert">
            <div>
                <strong>万岁</strong>
            </div>
            <div *ngFor="let message of messages">{{ message }}</div>
        </div>

        <div class="form-group">
            <label for="input-email" class="sr-only">输入你的电子邮件地址</label>
            <input name="email" [(ngModel)]="user.email" id="input-email" #email="ngModel" class="form-control" placeholder="邮箱"
                pattern=".+@.+\..+" [class.form-control-danger]="email.invalid && email.touched" [required]="true" autofocus>
            <small class="form-text error" *ngIf="email.invalid && email.touched && email.errors?.required">
               邮箱必填！
            </small>
            <small class="form-text error" *ngIf="email.invalid && email.touched && email.errors?.pattern">
                邮箱格式不对！
            </small>
        </div>

        <button [disabled]="submitted || !requestPassForm.form.valid" class="btn btn-hero-success btn-block" [class.btn-pulse]="submitted">
            重置密码
        </button>
    </form>

    <div class="links col-sm-12">
        <small class="form-text">
            已经有账号了？
            <a routerLink="../login">
                <strong>登陆</strong>
            </a>
        </small>
        <small class="form-text">
            <a routerLink="../register">
                <strong>注册</strong>
            </a>
        </small>
    </div>
</nb-auth-block>